<?php

declare(strict_types=1);

namespace app\common\model\order;

use app\common\model\BaseModel;

/**
 * 船票订单部分退款信息模型
 */
class ShipOrderPartialRefund extends BaseModel
{
    protected $name = 'ship_order_partial_refund';
    protected $pk = 'id';

    protected $autoWriteTimestamp = 'int';
    protected $createTime = 'create_time';
    protected $updateTime = 'update_time';

    protected $type = [
        'create_time' => 'timestamp',
        'update_time' => 'timestamp',
    ];
    
    /**
     * 字段验证规则
     * @var array
     */
    protected $schema = [
        'id'            => 'int',
        'ship_order_id' => 'int',
        'passenger_info' => 'string',
        'refund_amount' => 'float',
        'refund_reason' => 'string',
        'status'        => 'int',
        'create_time'   => 'timestamp',
        'update_time'   => 'timestamp',
    ];

    /**
     * 关联船票订单
     * @return \think\model\relation\BelongsTo
     */
    public function shipOrder()
    {
        return $this->belongsTo(ShipOrder::class, 'ship_order_id', 'id');
    }
}
